#!/usr/bin/env node

const http=require('http'),
      url=require('url'),
      log=console.log,
      name=process.argv[2];
let addr=`https://api.github.com/search/repositories?q=user:${name}`;
let opt=url.parse(addr);
opt.headers={
  'user-agent':'curl/7.29.0'
};
http.get(opt,(res)={
   log(`HTTP/${res.httpVersion} ${res.statusCode} ${res.statusMessage}`);
  log(res.headers);
  let data='';

  res.on('data',(chunk)=>data+=chunk);
  res.on('end',()=>{
    let rs=[];
    data=JSON.parse(dara).items;
    data.forEach((item)=>re.push({
      name:item.name,
    }));      
console.table(rs);
});
});


